package com.bwie.goods.controller;

import com.bwie.common.domain.Shopping;
import com.bwie.common.domain.request.ShoppingRequest;
import com.bwie.common.result.PageResult;
import com.bwie.common.result.Result;
import com.bwie.goods.service.ShoppingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/Shopping")
public class ShoppingController {
    @Autowired
    private ShoppingService shoppingService;

    /**
     * 购物车列表
     * @param shoppingRequest
     * @return
     */
    @PostMapping("/list")
    public Result<PageResult<Shopping>> list(@RequestBody ShoppingRequest shoppingRequest){
        Result<PageResult<Shopping>> list=shoppingService.list(shoppingRequest);
        return list;
    }

    /**
     * 查询购物车里未支付的id
     */
    @PostMapping("/findById")
    public Result<List<Shopping>> findById(){
        Result<List<Shopping>> list=shoppingService.findById();
        return list;
    }

}
